{include file="public/header" /}
<style>
  .padclass {
    padding: 0 10px
  }
</style>

<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-body">
            <fieldset id="searchFieldset_currentTableRenderId" class="table-search-fieldset">
              <legend>条件搜索</legend>
              <form class="layui-form layui-form-pane form-search">
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">类型</label>
                  <div class="layui-input-inline">
                    <select name="type">
                      <option value="">类型</option>
                      <option value="1" {if !empty(input('get.type')) && input('get.type')==1}selected{/if}>半天</option>
                      <option value="2" {if !empty(input('get.type')) && input('get.type')==2}selected{/if}>整天
                      </option>
                    </select>
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">审核状态</label>
                  <div class="layui-input-inline">
                    <select name="status">
                      <option value="">审核状态</option>
                      <option value="1" {if !empty(input('get.status')) && input('get.status')==1}selected{/if}>待审核
                      </option>
                      <option value="2" {if !empty(input('get.status')) && input('get.status')==2}selected{/if}>通过
                      </option>
                      <option value="3" {if !empty(input('get.status')) && input('get.status')==3}selected{/if}>驳回
                      </option>
                      <option value="4" {if !empty(input('get.status')) && input('get.status')==4}selected{/if}>撤销
                      </option>
                    </select>
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">请假人员</label>
                  <div class="layui-input-inline">
                    <select name="user_id" lay-search="">
                      <option value="">请假人员</option>
                      {foreach $dlist as $k => $v}
                      {if $v.del == 1}
                      <option value="{$v.id}" {if !empty(input('get.user_id')) &&
                        input('get.user_id')==$v.id}selected{/if}>
                        {$v.account|default=''}{if $v.del !=
                        1}账号已删除{/if}</option>
                      {/if}
                      {/foreach}
                    </select>
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">指定日期请假搜索</label>
                  <div class="layui-input-inline">
                    <input type="text" id="dates" name="dates" placeholder="含指定日期请假搜索" value="{:input('get.dates')}"
                      autocomplete="off" class="layui-input" />
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">
                    搜索
                  </button>
                </div>
              </form>
            </fieldset>
          </div>
          <div class="layui-card-body layui-row layui-col-space10">
            共有数据：<strong id="count">{$list->total()}</strong> 条
          </div>
          <div class="layui-table-body layui-table-main">
            <table class="layui-table">
              <thead>
                <tr>
                  <th width="50">
                    <div class="layui-table-cell">ID</div>
                  </th>
                  <th width="100">
                    <div class="layui-table-cell">请假类型</div>
                  </th>
                  <th width="100">
                    <div class="layui-table-cell">请假人</div>
                  </th>
                  <th width="100">
                    <div class="layui-table-cell">请假时间</div>
                  </th>
                  <th width="100">
                    <div class="layui-table-cell">时长</div>
                  </th>
                  <th width="100">
                    <div class="layui-table-cell">说明</div>
                  </th>
                  <th width="200">
                    <div class="layui-table-cell">状态|操作</div>
                  </th>
                </tr>
              </thead>
              <tbody>
                {foreach $list as $v}
                <tr>
                  <td>
                    <div class="layui-table-cell">{$v.id}</div>
                  </td>
                  <td>
                    <div class="layui-table-cell">{if $v.type == 1}半天假计算{else}整天假{/if}
                    </div>
                  </td>
                  <td>
                    <div class="layui-table-cell">{$v.user_name}</div>
                  </td>
                  <td>
                    <div class="layui-table-cell">
                      {$v.startime} {if $v.type == 1}{if $v.startype == 1}上午{elseif $v.startype == 2}下午{/if}{/if}
                       ~ 
                      {$v.endtime} {if $v.type == 1}{if $v.endtype == 1}上午{elseif $v.endtype == 2}下午{/if}{/if}</div>
                    
                  </td>
                  <td>
                    <div class="layui-table-cell">{$v.duration}天</div>
                  </td>
                  <td>
                    <div class="layui-table-cell">{$v.remark}</div>
                  </td>
                  <td>
                    <div class="layui-table-cell">
                      {if $v.status == 1}
                      <a title="确认操作" onclick="open_status(this, '/shop/leavestatus', '{$v.id}', 2)"
                        href="javascript:;" class="layui-btn layui-btn-sm  layui-bg-blue">
                        同意请假申请
                      </a>
                      <a title="确认操作" onclick="open_status(this, '/shop/leavestatus', '{$v.id}', 3)"
                        href="javascript:;" class="layui-btn layui-btn-sm">
                        拒绝请假申请
                      </a>
                      {elseif $v.status == 2}审核通过{elseif $v.status == 3}审核驳回{elseif $v.status == 4}撤回申请{/if}
                    </div>
                  </td>
                </tr>
                {/foreach}
              </tbody>
            </table>
          </div>
          <div class="layui-card-body">
            <div class="page">{$list->render()|raw}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
  {include file="public/footer"}
  <script>
    layui.use(['form', 'layer', 'laydate'], function () {
      $ = layui.jquery;
      var laydate = layui.laydate;
      var form = layui.form
        , layer = layui.layer;
      laydate.render({
        elem: '#dates' //指定元素
        , type: 'day'
      });
    });
  </script>
</body>